import React from 'react'
import Tit from '../../components/Tit'
import { withRouter } from 'react-router-dom'
import Address from '../../components/Address'
import OrderShop from '../../components/OrderShop'
import './RefundDetail.less'
class RefundDetail extends React.Component {
    state = {
        OrderDetail: null
    }
    componentDidMount() {
        this.$postData('/api/order/getGoodsMsg', { id: this.props.match.params.id }, params => {
            console.log(params)
            switch (params.code) {
                case 100:
                    this.setState({
                        OrderDetail: params.data
                    })
                    break;
                default:
                    this.Toast.info(params.msg);
                    break;
            }
        })
    }
    render() {
        return (
            <div className='Refaun'>
                {this.state.OrderDetail ? <div className='OrderD FillO-page Address-white'>
                    <Tit zz={true} ID={1} tit={'订单详情'}></Tit>
                    <div className=''>
                        
                    </div>
                    <OrderShop data={this.state.OrderDetail} ID={1} status={this.state.OrderDetail.status}></OrderShop>
                    <div className='OrderD-d1 xin-center'>
                        <p>订单编号:</p>
                        <p>{this.state.OrderDetail.orderNo}</p>
                    </div>
                    <div className='OrderD-d1 xin-center'>
                        <p>下单时间:</p>
                        <p>{this.state.OrderDetail.createTime}</p>
                    </div>
                    <div className='OrderD-d2'>
                        退款金额: ¥{this.state.OrderDetail.orderPayPrice}
                    </div>
                    <div className='OrderD-d1 xin-center'>
                        <p>{this.state.OrderDetail.status === -1 ? '退款失败原因' : '退款原因'}</p>
                        <p>¥{this.state.OrderDetail.status === -1 ? this.state.OrderDetail.refuseReason : this.state.OrderDetail.returnGoodsReason}</p>
                    </div>
                    <div className='diandi'></div>
                </div> : <div></div>}
            </div>
        )
    }
}

export default withRouter(RefundDetail)